<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>wuba APP</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <style type="text/css">
        .aui-bar-my{
            background-color: #e65a65; 
        }

        .aui-nav .aui-bar-tab .active-warning .aui-iconfont, .aui-nav .aui-bar-tab .active-warning p {
            color: #e65a65;
        }


    </style>
</head>

<body class="wrap">
    <header class="aui-bar aui-bar-nav aui-bar-my" id='aui-header'>舞吧舞吧-<span id='header-title'></span></header>
    <section class='flex-1'>
      






    </section>
    <footer class="aui-nav" id="aui-footer">
        <ul class="aui-bar-tab">
            <li class="active-warning" id="tabbar1" tapmode onclick="randomSwitchBtn(this,'热门',0)">
                <span class="aui-iconfont aui-icon-hotfill"></span>
                <p>热门</p>
            </li>
            <li id="tabbar2" tapmode onclick="randomSwitchBtn(this,'活动',1)">
                <span class="aui-iconfont aui-icon-list"></span>
                <p>活动</p>
            </li>
            <li id="tabbar3" tapmode onclick="randomSwitchBtn(this,'神曲',2)">
                <span class="aui-iconfont aui-icon-radioboxfill"></span>
                <p>神曲</p>
            </li>
            <li id="tabbar4" tapmode onclick="randomSwitchBtn(this,'关于',3)">
                <span class="aui-iconfont aui-icon-service"></span>
                <p>关于</p>
            </li>
        </ul>
    </footer>
 </body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript" src="./script/aui.js"></script>
<script type="text/javascript">
    apiready = function(){
        api.parseTapmode();
        var header = $api.byId('aui-header');
        $api.fixStatusBar(header); 
        var headerPos = $api.offset(header);
        var body_h = $api.offset($api.dom('body')).h;
        var footer_h = $api.offset($api.byId('aui-footer')).h;
        api.openFrameGroup ({
            name: 'footer_tab_demo',
            scrollEnabled:true,
            rect:{x:0, y:headerPos.h, w:'auto', h:body_h - headerPos.h - footer_h},
            index:0,
            preload:3,
            frames:
            [{
                name: 'footer_tab_1', 
                //装载热门子页面
                url: 'html/remen.html', 
                bounces:false
            },{
                name: 'footer_tab_2', 
                //加载活动子页面
                url: 'html/hd.html', 
                bounces:false
            },{
                name: 'footer_tab_3', 
                url: 'html/sq.html', 
                bounces:false
            },{
                name: 'footer_tab_4', 
                url: 'html/about.html', 
                bounces:false
            }]
        }, function(ret, err){
            var footer = $api.byId('aui-footer');
            var footerAct = $api.dom(footer, '.aui-bar-tab li.active-warning');
            $api.removeCls(footerAct, 'active-warning');
            var name = ret.name;
            var index = ret.index;
            if(index==0){
                $api.text($api.byId('header-title'),'热门');
                $api.addCls($api.byId('tabbar1'), 'active-warning');
            }else if(index==1){
                $api.text($api.byId('header-title'),'活动');
                $api.addCls($api.byId('tabbar2'), 'active-warning');
            }else if(index==2){
                $api.text($api.byId('header-title'),'神曲');
                $api.addCls($api.byId('tabbar3'), 'active-warning');
            }else if(index==3){
                $api.text($api.byId('header-title'),'关于');
                $api.addCls($api.byId('tabbar4'), 'active-warning');
            }
        })
    }
    function closeWin(){
        api.closeWin();
    }
    function randomSwitchBtn(obj, name, index) {
        $api.text($api.byId('header-title'),name);
        var footer = $api.byId('aui-footer');
        var footerAct = $api.dom(footer, '.aui-bar-tab li.active-warning');
        $api.removeCls(footerAct, 'active-warning');
        $api.addCls(obj, 'active-warning');
        api.setFrameGroupIndex({
            name: 'footer_tab_demo',
            index: index,
            scroll:true
        });

    }
</script>
</html>
